home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / devices / net.1 < prev    next >
Internet Message Format  |  1989-09-16  |  42KB

  1. Path: xanth!lll-winken!ames!sun-barr!newstop!sun!swap!page
  2. From: page%swap@Sun.COM (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i174:  net - network (net:) device, Part01/04
  5. Message-ID: <124771@sun.Eng.Sun.COM>
  6. Date: 15 Sep 89 07:28:46 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 1398
  9. Approved: page@sun.com
  10.  
  11. Submitted-by: sas!walker@mcnc.org (Doug Walker)
  12. Posting-number: Volume 89, Issue 174
  13. Archive-name: devices/net.1
  14.  
  15. This is the Lattice C source code to the Software Distillery network
  16. file system.  It also serves as a good working example file system.
  17. NET: uses Matt Dillon's DNET to allow an Amiga to read and write
  18. AmigaDOS devices on another Amiga as if they were mounted locally.
  19.  
  20. # This is a shell archive.
  21. # Remove anything above and including the cut line.
  22. # Then run the rest of the file through 'sh'.
  23. # Unpacked files will be owned by you and have default permissions.
  24. #----cut here-----cut here-----cut here-----cut here----#
  25. #!/bin/sh
  26. # shar: SHell ARchive
  27. # Run the following text through 'sh' to create:
  28. #    channel.h
  29. #    debug.c
  30. #    dnet.h
  31. #    dnetlib.c
  32. #    doc/README
  33. #    doc/dnet.servers
  34. #    doc/mountlist
  35. #    doc/netsource.doc
  36. # This is archive 1 of a 4-part kit.
  37. # This archive created: Fri Sep 15 00:24:29 1989
  38. echo "extracting channel.h"
  39. sed 's/^X//' << \SHAR_EOF > channel.h
  40. X
  41. X/*
  42. X *  CHANNEL.H
  43. X *
  44. X *  DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved.
  45. X *
  46. X *  Channel structures for SCMD_* channel commands.
  47. X */
  48. X
  49. X#ifndef DNET_H
  50. Xtypedef unsigned char ubyte;
  51. Xtypedef unsigned short uword;
  52. Xtypedef unsigned long ulong;
  53. Xtypedef struct MsgPort PORT;
  54. Xtypedef struct IOStdReq IOR;
  55. X#endif
  56. X
  57. X#define CSWITCH struct _CSWITCH
  58. X#define COPEN    struct _COPEN
  59. X#define CCLOSE    struct _CCLOSE
  60. X#define CACKCMD struct _CACKCMD
  61. X#define CEOFCMD struct _CEOFCMD
  62. X#define CIOCTL    struct _CIOCTL
  63. X
  64. XCSWITCH {        /*  SWITCH current data channel */
  65. X    ubyte   chanh;
  66. X    ubyte   chanl;
  67. X};
  68. X
  69. XCOPEN {         /*  OPEN port on channel    */
  70. X    ubyte   chanh;
  71. X    ubyte   chanl;
  72. X    ubyte   porth;
  73. X    ubyte   portl;
  74. X    ubyte   error;    /*  error return 0=ok        */
  75. X    ubyte   pri;
  76. X};
  77. X
  78. XCCLOSE {        /*  CLOSE a channel        */
  79. X    ubyte   chanh;
  80. X    ubyte   chanl;
  81. X};
  82. X
  83. XCACKCMD {        /*  Acknowledge an open/close        */
  84. X    ubyte   chanh;
  85. X    ubyte   chanl;
  86. X    ubyte   error;    /*  ERETRY ENOPORT ECLOSE1 ECLOSE2  */
  87. X    ubyte   filler;
  88. X};
  89. X
  90. XCEOFCMD {        /*  Send [R/W] EOF        */
  91. X    ubyte   chanh;
  92. X    ubyte   chanl;
  93. X    ubyte   flags;
  94. X    ubyte   filler;
  95. X};
  96. X
  97. XCIOCTL {
  98. X    ubyte   chanh;    /* channel            */
  99. X    ubyte   chanl;
  100. X    ubyte   cmd;    /* ioctl command        */
  101. X    ubyte   valh;    /* ioctl value            */
  102. X    ubyte   vall;
  103. X    ubyte   valaux;    /* auxillary field        */
  104. X};
  105. X
  106. X#define CIO_SETROWS    1    /* PTY's only                   */
  107. X#define CIO_SETCOLS    2    /* PTY's only                   */
  108. X#define CIO_STOP    3    /* any channel, flow control    */
  109. X#define CIO_START    4    /* any channel, flow control    */
  110. X#define CIO_FLUSH    5
  111. X
  112. X#define CHAN    struct _CHAN
  113. X
  114. XCHAN {
  115. X    PORT    *port;
  116. X    IOR     *ior;
  117. X    ubyte   state;
  118. X    ubyte   flags;
  119. X    char    pri;    /*  transmit priority    */
  120. X};
  121. X
  122. SHAR_EOF
  123. echo "extracting debug.c"
  124. sed 's/^X//' << \SHAR_EOF > debug.c
  125. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  126. X/* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
  127. X/* |. o.| || This program may not be distributed without the permission of   */
  128. X/* | .  | || the author.                                           BBS:      */
  129. X/* | o  | ||   John Toebes    Dave Baker                     (919)-471-6436  */
  130. X/* |  . |//                                                                  */
  131. X/* ======                                                                    */
  132. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  133. X#define NETCOMMON
  134. X#include "netcomm.h"
  135. X#include "proto.h"
  136. X#include <ctype.h>
  137. X
  138. X#if PARANOID
  139. Xint paranoid = 1;
  140. X#endif
  141. X
  142. X#if CPR
  143. X
  144. XBPTR debuglog = NULL;
  145. Xextern char *dbgwind;
  146. Xstatic void makehex U_ARGS((char *, char *));
  147. Xstatic void termlog U_ARGS((void));
  148. Xstatic void xclose U_ARGS((BPTR));
  149. Xstatic BPTR xopen  U_ARGS((char *));
  150. X
  151. XBPTR initdebug(fh)
  152. XBPTR fh;
  153. X{
  154. X   BPTR ofh;
  155. X#if DEBUG
  156. X   ofh = debuglog;
  157. X   if(!(debuglog = fh)) debuglog = xopen(dbgwind);
  158. X#else
  159. X   ofh = NULL;
  160. X#endif
  161. X
  162. X   BUG(("DEBUGGING INITIALIZED\n"));
  163. X
  164. X   return(ofh);
  165. X}
  166. X
  167. Xvoid termdebug()
  168. X{
  169. X   BUG(("Closing log\n"));
  170. X   BUGGETC
  171. X
  172. X   if(debuglog) xclose(debuglog);
  173. X   debuglog = NULL;
  174. X}
  175. X
  176. XBPTR xopen(name)
  177. Xchar *name;
  178. X{
  179. X   return(Open(name, 1006));
  180. X}
  181. X
  182. Xvoid xclose(log)
  183. XBPTR log;
  184. X{
  185. X   long args[1];
  186. X   struct FileHandle *fh;
  187. X
  188. X   if(!log) return;
  189. X
  190. X   fh = (struct FileHandle *)BADDR(log);
  191. X   args[0] = (long)fh->fh_Arg1;
  192. X   sendpkt(fh->fh_Type,ACTION_END,args,1);
  193. X}
  194. X
  195. Xvoid xwrite(str,len)
  196. Xchar *str;
  197. Xint len;
  198. X{
  199. X   long args[3];
  200. X   struct FileHandle *fh;
  201. X
  202. X   if(!debuglog) return;
  203. X
  204. X   fh = (struct FileHandle *)BADDR(debuglog);
  205. X   args[0] = (long)fh->fh_Arg1;
  206. X   args[1] = (long)str;
  207. X   args[2] = (long)len;
  208. X   sendpkt(fh->fh_Type,ACTION_WRITE,args,3);
  209. X}
  210. X
  211. X#define CRMSG "Hit RETURN to continue: "
  212. X
  213. Xvoid xgetcr()
  214. X{
  215. X   long args[3];
  216. X   struct FileHandle *fh;
  217. X   char stuff[10];
  218. X
  219. X   if(!debuglog) return;
  220. X
  221. X   xwrite(CRMSG, strlen(CRMSG));
  222. X   fh = (struct FileHandle *)BADDR(debuglog);
  223. X   args[0] = (long)fh->fh_Arg1;
  224. X   args[1] = (long)stuff;
  225. X   args[2] = 9L;
  226. X   sendpkt(fh->fh_Type,ACTION_READ,args,3);
  227. X}
  228. X
  229. Xvoid myprintf(str,p1,p2,p3,p4,p5,p6,p7,p8,p9)
  230. Xchar *str;
  231. Xchar *p1,*p2,*p3,*p4,*p5,*p6,*p7,*p8,*p9;
  232. X{
  233. X   char buf[128];
  234. X   int len;
  235. X
  236. X   if(!debuglog) return;
  237. X
  238. X   len = sprintf(buf,str,p1,p2,p3,p4,p5,p6,p7,p8,p9);
  239. X   if (len>128) len = 128;
  240. X   xwrite(buf,len);
  241. X}
  242. X
  243. Xvoid myputbstr(str, name)
  244. Xchar *str;
  245. Xchar *name;
  246. X{
  247. X   int len;
  248. X
  249. X   if(!debuglog) return;
  250. X
  251. X   xwrite(str, strlen(str));
  252. X   len = *name++;
  253. X   xwrite(name, len);
  254. X   xwrite("\n", 1);
  255. X}
  256. X
  257. Xvoid myputlstr(str, name, len)
  258. Xchar *str;
  259. Xchar *name;
  260. Xint len;
  261. X{
  262. X   if(!debuglog) return;
  263. X
  264. X   xwrite(str, strlen(str));
  265. X   xwrite(name, len);
  266. X   xwrite("\n", 1);
  267. X}
  268. X
  269. Xstatic void makehex(s, h)
  270. Xchar *s;
  271. Xchar *h;
  272. X{
  273. X   int i;
  274. X   static char *digits = "0123456789ABCDEF";
  275. X
  276. X   if(!debuglog) return;
  277. X
  278. X   for(i=0; i<8; i+=2)
  279. X   {
  280. X      h[i]   = digits[ (s[i/2] & 0xf0) >> 4 ];
  281. X      h[i+1] = digits[ (s[i/2] & 0x0f)      ];
  282. X   }
  283. X}
  284. X
  285. Xvoid mydump(s, l)
  286. Xunsigned char *s;
  287. Xint l;
  288. X{
  289. X   int i, j;
  290. X   char h[9];
  291. X
  292. X   if(!debuglog) return;
  293. X
  294. X   h[8] = 0;
  295. X   BUG(("Dumping %ld bytes starting at addr %08.8x\n", l, s));
  296. X   for(i=0; i<l; i+=16)
  297. X   {
  298. X      BUG(("%08.8lx: ", i));
  299. X
  300. X      for(j=0; j<16; j+=4)
  301. X      {
  302. X         makehex(&s[i+j], h);
  303. X         if(i+j<l){BUG(("%8.8s ", h));}
  304. X         else     {BUG(("         "));}
  305. X      }
  306. X
  307. X      for(j=0; j<16 && i+j<l; j++)
  308. X         if(isprint(s[i+j])) {BUG(("%c", s[i+j]));}
  309. X         else {BUG(("."));}
  310. X
  311. X      BUG(("\n"));
  312. X   }
  313. X}
  314. X
  315. Xvoid cprwait(global)
  316. XGLOBAL global;
  317. X{
  318. X   int i, j, oldpri;
  319. X
  320. X   if(!request(global, REQ_GENERAL, "Loop for debug?")) return;
  321. X   
  322. X   BUG(("********* DEBUG WAIT LOOP ***********\n"))
  323. X   BUG(("******* CATCH TASK WITH CPR *********\n"))
  324. X   oldpri = SetTaskPri(FindTask(NULL), -20);
  325. X   i=1;
  326. X   
  327. X   /* This loop will go until you set i to 0 with CPR */
  328. X   while(i)
  329. X   {
  330. X      BUG(("."))
  331. X      for(j=0; 
  332. X          i && j<100000; 
  333. X          j++);
  334. X   }
  335. X
  336. X   SetTaskPri(FindTask(NULL), oldpri);
  337. X   return;
  338. X}
  339. X#else
  340. Xvoid cprwait(global)
  341. XGLOBAL global;
  342. X{return;}
  343. X#endif CPR SHAR_EOF
  344. echo "extracting dnet.h"
  345. sed 's/^X//' << \SHAR_EOF > dnet.h
  346. X
  347. X/*
  348. X *  DNET.H
  349. X *
  350. X *  DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved.
  351. X *
  352. X */
  353. X
  354. X#define DNET_H
  355. X
  356. X#ifdef LATTICE
  357. X#include <exec/types.h>
  358. X#include <exec/nodes.h>
  359. X#include <exec/lists.h>
  360. X#include <exec/ports.h>
  361. X#include <exec/libraries.h>
  362. X#include <exec/devices.h>
  363. X#include <exec/io.h>
  364. X#include <exec/memory.h>
  365. X#include <exec/interrupts.h>
  366. X#include <intuition/intuition.h>
  367. X#include <devices/console.h>
  368. X#include <devices/timer.h>
  369. X#include <libraries/dos.h>
  370. X#include <libraries/dosextens.h>
  371. X#include <libraries/filehandler.h>
  372. X#include <string.h>
  373. X#include <stdlib.h>
  374. X#include <proto/exec.h>
  375. X#include <proto/dos.h>
  376. X
  377. X#define U_ARGS(a) a
  378. X
  379. X#else
  380. X
  381. X#define U_ARGS(a) ()    /* No support for prototypes - oh well */
  382. X
  383. X#endif
  384. X
  385. X
  386. Xtypedef unsigned char   ubyte;
  387. Xtypedef unsigned short  uword;
  388. Xtypedef unsigned long   ulong;
  389. X
  390. Xtypedef struct MsgPort      PORT;
  391. Xtypedef struct timerequest  IOT;
  392. Xtypedef struct IOStdReq     IOR;
  393. Xtypedef struct List         LIST;
  394. Xtypedef struct Node         NODE;
  395. Xtypedef struct Process      PROC;
  396. Xtypedef struct Message      MSG;
  397. X
  398. X#include "channel.h"
  399. X
  400. X#ifndef MAX(a,b)
  401. X#define MAX(a,b) (((a)>(b))?(a):(b))
  402. X#endif
  403. X
  404. X#define PKT struct _PKT
  405. X#define PNODE   struct _PNODE
  406. X
  407. X#define BTOC(yow)           ((ubyte *)((long)(yow) << 2))
  408. X#define DNETPORTNAME        "DNET.UNIT."
  409. X#define OFFSET(ptr,elem)    ((long)((char *)&(ptr)->elem - (char *)(ptr)))
  410. X
  411. X#define EMPTY   0       /*  empty (sent)                    */
  412. X#define READY   1       /*  data ready (not sent yet)       */
  413. X
  414. X#define MAXCHAN 128     /*  Max # of channels supported     */
  415. X#define SYNC    0xFF    /*  SYNC character                  */
  416. X#define MAXPKT  200     /*  maximum packet size             */
  417. X#define MINPKT  32      /*  minimum maximum packet size
  418. X                            (for priority scheme)           */
  419. X
  420. X#define OVERHEAD    7   /*  for packets with data           */
  421. X
  422. XPNODE {
  423. X    NODE    node;
  424. X    char    name[32];
  425. X    ulong   seg;
  426. X};
  427. X
  428. XPKT {
  429. X    uword   iolength;   /*  send: length of packet, recv: length of data    */
  430. X    ubyte   state;      /*  EMPTY, READY     */
  431. X
  432. X    ubyte   sync;       /*  THE PACKET      */
  433. X    ubyte   ctl;
  434. X    ubyte   cchk;
  435. X    ubyte   lenh;
  436. X    ubyte   lenl;
  437. X    ubyte   data[MAXPKT+2];
  438. X};
  439. X
  440. X/*  RECEIVER STATES    */
  441. X#define RS_SYNC 0           /*  Waiting for sync                */
  442. X#define RS_CTL  1           /*  Waiting for command             */
  443. X#define RS_CCHK 2           /*  Waiting for check byte          */
  444. X#define RS_LEN1 3           /*  Waiting for MSB length byte     */
  445. X#define RS_LEN2 4           /*  Waiting for LSB length byte     */
  446. X#define RS_DATA 5           /*  Waiting for data & checksum     */
  447. X
  448. X#define DNCMD_OPEN      32  /*  Application open                */
  449. X#define DNCMD_SOPEN     33  /*  Server open                     */
  450. X#define DNCMD_CLOSE     34  /*  Close a channel                 */
  451. X#define DNCMD_EOF       35  /*  Will no longer write to channel */
  452. X
  453. X#define DNCMD_WRITE     36  /*  Write data to a channel         */
  454. X#define DNCMD_QUIT      37  /*  Kill the DNET server            */
  455. X#define DNCMD_IOCTL     38
  456. X
  457. X/*  REQUEST TYPES    */
  458. X#define RTO_REQ         1   /*  Network read timeout            */
  459. X#define WTO_REQ         2   /*  Network write-ack timeout       */
  460. X#define RNET_REQ        3   /*  Network read data               */
  461. X#define WNET_REQ        4   /*  Network write data sent         */
  462. X#define PKT_REQ         5   /*  Returned packets from servers   */
  463. X#define OPEN_REQ        6
  464. X#define IGWNET_REQ      7
  465. X
  466. X/* PACKET CONTROL BYTE */
  467. X#define PKF_SEQUENCE    0xE0    /*  Sequence #                  */
  468. X#define PKF_DATA        0x10    /*  1-65535 bytes               */
  469. X#define PKF_RESERVED    0x08    /*  reserved bit                */
  470. X#define PKF_MASK        0x07    /*  command mask                */
  471. X
  472. X#define PKCMD_WRITE     1       /*  A DATA packet               */
  473. X#define PKCMD_CHECK     2       /*  Request ACK or NAK for win  */
  474. X#define PKCMD_ACK       3       /*  ACK a window                */
  475. X#define PKCMD_NAK       4       /*  NAK a window                */
  476. X#define PKCMD_RESTART   5       /*  Restart                     */
  477. X#define PKCMD_ACKRSTART 6       /*  Restart Acknowledge         */
  478. X#define PKCMD_RESERVE3  7
  479. X/*  CHANNEL COMMANDS    */
  480. X#define SCMD_SWITCH     0x00    /*  switch active channel #     */
  481. X#define SCMD_OPEN       0x01    /*  open a channel              */
  482. X#define SCMD_CLOSE      0x02    /*  close a channel             */
  483. X#define SCMD_ACKCMD     0x03    /*  ack an open/close request   */
  484. X#define SCMD_EOFCMD     0x04    /*  Reof or Weof                */
  485. X#define SCMD_QUIT       0x05    /*  crash dnet                  */
  486. X#define SCMD_IOCTL      0x06    /*  ioctl                       */
  487. X
  488. X#define SCMD_DATA       0x08    /*  stream command, DATA        */
  489. X
  490. X#define CHAN_FREE       0x01    /*  free channel                */
  491. X#define CHAN_ROPEN      0x02    /*  remote open, wait port msg  */
  492. X#define CHAN_LOPEN      0x03    /*  local open, wait reply      */
  493. X#define CHAN_OPEN       0x04
  494. X#define CHAN_CLOSE      0x05    /*  see flags                   */
  495. X#define CHANF_ROK       0x01    /*  NOT read eof                */
  496. X#define CHANF_WOK       0x02    /*  remote will accept data     */
  497. X#define CHANF_LCLOSE    0x04
  498. X#define CHANF_RCLOSE    0x08
  499. X
  500. Xstruct DChannel {
  501. X    PORT    port;             /*  receive data, replies      */
  502. X    PORT    *dnetport;        /* dnet's master port          */
  503. X    LIST    rdylist;          /* ready to be read            */
  504. X    uword   chan;             /* channel # for open channels */
  505. X    ubyte   eof;              /* channel remotely closed/eof */
  506. X    ubyte   filler;
  507. X    int     qlen;             /* allowed write queue size    */
  508. X    int     queued;           /* current # packets queued    */
  509. X};
  510. X
  511. Xextern void  *ArbitrateNext();
  512. X
  513. X#ifndef NOEXT
  514. Xextern IOT Rto;                /*  Read-Timeout/reset          */
  515. Xextern IOT Wto;                /*  Write-Timeout/retry         */
  516. Xextern IOR *RNet;              /*  read-request                */
  517. Xextern IOR *WNet;              /*  write-request               */
  518. Xextern PKT Pkts[9];
  519. Xextern PKT *Raux;              /*  next packet in              */
  520. Xextern PKT *RPak[4];
  521. Xextern PKT *WPak[4];
  522. Xextern PORT *DNetPort;         /*  Remote Command/Control in       */
  523. Xextern PORT *IOSink;           /*  Return port for ALL IO          */
  524. Xextern CHAN Chan[MAXCHAN];
  525. Xextern LIST TxList;            /*  For pending DNCMD_WRITE reqs.   */
  526. Xextern LIST SvList;
  527. Xextern ubyte Rto_act;
  528. Xextern ubyte Wto_act;
  529. Xextern uword RChan;
  530. Xextern uword WChan;
  531. Xextern uword RPStart;
  532. Xextern uword WPStart;
  533. Xextern uword WPUsed;
  534. Xextern uword RState;
  535. Xextern ubyte DDebug;
  536. Xextern ubyte Restart;
  537. Xextern ubyte DeldQuit;
  538. Xextern ubyte AutoHangup;
  539. Xextern ulong NumCon;
  540. Xextern ulong WTimeoutVal;
  541. Xextern ulong RTimeoutVal;
  542. Xextern long Baud;
  543. Xextern char *HostName;      /*   The Amiga's HostName    */
  544. X
  545. Xextern ubyte RestartPkt[3];
  546. Xextern ubyte AckPkt[8][3];
  547. Xextern ubyte NakPkt[8][3];
  548. Xextern ubyte CheckPkt[8][3];
  549. X#endif
  550. X
  551. X#ifdef LATTICE
  552. X/* One #ifdef LATTICE is worth 1000 U_ARGS macros! */
  553. XPORT *DListen(uword);
  554. Xvoid DUnListen(PORT *);
  555. XPORT *DAccept(PORT *);
  556. XDNAAccept(PORT *);
  557. Xvoid DPri(struct DChannel *, int);
  558. XPORT *DOpen(char * /*host*/, uword /*portnum*/, 
  559. X            char /*txpri*/, char /*rxpri*/);
  560. Xint DNRead(struct DChannel *, char *, int);
  561. Xint DRead(struct DChannel *, char *, int);
  562. Xvoid DQueue(struct DChannel *, int);
  563. XDWrite(struct DChannel *, char *, int);
  564. Xvoid DEof(struct DChannel *);
  565. Xvoid DIoctl(struct DChannel *, ubyte, uword, ubyte);
  566. Xint DQuit(char *);
  567. Xvoid DClose(struct DChannel *);
  568. Xvoid WaitMsg(IOR *);
  569. Xint WaitQueue(struct DChannel *, IOR *);
  570. X
  571. X#endif
  572. X
  573. SHAR_EOF
  574. echo "extracting dnetlib.c"
  575. sed 's/^X//' << \SHAR_EOF > dnetlib.c
  576. X/*
  577. X *  DNETLIB.C
  578. X *
  579. X *  DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved.
  580. X *
  581. X *  Library Interface for DNET.
  582. X */
  583. X
  584. X#define NOEXT
  585. X#define NETCOMMON
  586. X#include "dnet.h"
  587. X#include "netcomm.h"
  588. X#include "proto.h"
  589. X
  590. Xstatic struct DChannel *MakeChannel U_ARGS((IOR *, char *));
  591. Xstatic void DeleteChannel U_ARGS((struct DChannel *));
  592. Xstatic void FixSignal     U_ARGS((struct DChannel *));
  593. X
  594. X#define NAMELEN sizeof("DNET.PORT.XXXXX")
  595. X#define NAMEPAT "DNET.PORT.%ld"
  596. X
  597. XPORT *DListen(portnum)
  598. Xuword portnum;
  599. X{
  600. X    PORT *port;
  601. X    char *ptr;
  602. X
  603. X    port = NULL;
  604. X    ptr = AllocMem(NAMELEN, MEMF_PUBLIC);   /*  memory the the name     */
  605. X    sprintf(ptr, NAMEPAT, portnum);
  606. X    Forbid();                               /*  task-atomic operation   */
  607. X    if (FindPort(ptr) || !(port = CreatePort(ptr,0)))
  608. X       FreeMem(ptr, NAMELEN);
  609. X    Permit();
  610. X    return(port);
  611. X}
  612. X
  613. Xvoid
  614. XDUnListen(lisport)
  615. XPORT *lisport;
  616. X{
  617. X   register char *ptr;
  618. X   ptr = lisport->mp_Node.ln_Name;
  619. X
  620. X   if (lisport)
  621. X   {
  622. X      Forbid();                       /*  task-atomic operation       */
  623. X      while (DNAAccept(lisport));     /*  remove all pending requests */
  624. X      DeletePort(lisport);            /*  gone!                       */
  625. X      Permit();
  626. X      FreeMem(ptr, NAMELEN);
  627. X   }
  628. X}
  629. X
  630. X/*
  631. X *  DAccept()
  632. X *
  633. X *  Note:   This call will work even if called by a task which does not
  634. X *          own the listen port.
  635. X */
  636. X
  637. XPORT *
  638. XDAccept(lisport)
  639. XPORT *lisport;
  640. X{
  641. X    register IOR *ior;
  642. X    register struct DChannel * chan;
  643. X
  644. XBUG(("DAccept: Entry, port %lx\n", lisport))
  645. X
  646. X    chan = NULL;
  647. X    while (!chan && (ior = (IOR *)GetMsg(lisport))) {
  648. X       switch(ior->io_Command) {
  649. X          case DNCMD_SOPEN:
  650. X             BUG(("DAccept: SOPEN command\n"))
  651. X             chan = MakeChannel(ior, NULL);
  652. X             break;
  653. X          default:
  654. X             BUG(("DAccept: Unrecognized command '%d'\n", ior->io_Command))
  655. X             ior->io_Error = 1;
  656. X             break;
  657. X        }
  658. X        BUG(("DAccept: Replying\n"))
  659. X        ReplyMsg(&ior->io_Message);
  660. X    }
  661. X    BUG(("DAccept: After while loop\n"))
  662. X    if (lisport->mp_MsgList.lh_Head != (NODE *)&lisport->mp_MsgList.lh_Tail)
  663. X       SetSignal(1 << lisport->mp_SigBit, 1 << lisport->mp_SigBit);
  664. X
  665. X    return(chan ? &chan->port : NULL);
  666. X}
  667. X
  668. X/*
  669. X *  Refuse a connection
  670. X */
  671. X
  672. XDNAAccept(lisport)
  673. XPORT *lisport;
  674. X{
  675. X    IOR *ior;
  676. X
  677. X    if (ior = (IOR *)GetMsg(lisport)) {
  678. X        ior->io_Error = 1;
  679. X        ReplyMsg(&ior->io_Message);
  680. X    }
  681. X    if (lisport->mp_MsgList.lh_Head != (NODE *)&lisport->mp_MsgList.lh_Tail)
  682. X       SetSignal(1 << lisport->mp_SigBit, 1 << lisport->mp_SigBit);
  683. X    return(ior != NULL);
  684. X}
  685. X
  686. Xvoid DPri(chan, pri)
  687. Xstruct DChannel * chan;
  688. Xint pri;
  689. X{
  690. X}
  691. X
  692. X
  693. XPORT *
  694. XDOpen(host, portnum, txpri, rxpri)
  695. Xchar *host;
  696. Xchar txpri, rxpri;
  697. Xuword portnum;
  698. X{
  699. X    IOR ior;
  700. X    struct DChannel *chan;
  701. X
  702. X    if (!host)
  703. X       host = "0";
  704. X    chan = MakeChannel(&ior, host);
  705. X    if (rxpri > 126)
  706. X        rxpri = 126;
  707. X    if (rxpri < -127)
  708. X        rxpri = -127;
  709. X    if (txpri > 126)
  710. X        txpri = 126;
  711. X    if (txpri < -127)
  712. X        txpri = -127;
  713. X    if (chan->dnetport) {
  714. X        ior.io_Command = DNCMD_OPEN;
  715. X        ior.io_Unit = (void *)portnum;
  716. X        ior.io_Offset = (long)chan;
  717. X        ior.io_Message.mn_ReplyPort = &chan->port;
  718. X        ior.io_Message.mn_Node.ln_Pri = txpri;
  719. X        ior.io_Message.mn_Node.ln_Name= (char *)rxpri;
  720. X
  721. X        PutMsg(chan->dnetport, &ior.io_Message);
  722. X        WaitMsg(&ior);
  723. X        if (ior.io_Error == 0) {
  724. X           chan->chan = (long)ior.io_Unit;
  725. X           FixSignal(chan);
  726. X           return(&chan->port);
  727. X       }
  728. X    }
  729. X    DeleteChannel(chan);
  730. X    return(NULL);
  731. X}
  732. X
  733. X
  734. XDNRead(chan, buf, bytes)
  735. Xstruct DChannel * chan;
  736. Xchar *buf;
  737. Xint bytes;
  738. X{
  739. X    register IOR *ior;
  740. X    int len;
  741. X    long n;
  742. X
  743. X    len = 0;
  744. X    if (chan->eof)
  745. X       return(-1);
  746. X    while (bytes && ((ior = (IOR *)
  747. X               RemHead((struct List *)&chan->rdylist)) || 
  748. X               (ior = (IOR *)GetMsg(&chan->port)))) {
  749. X       if (ior->io_Message.mn_Node.ln_Type == NT_REPLYMSG) 
  750. X       {
  751. X          if (!chan->queued)
  752. X          {
  753. X             BUG(("DNRead: Software Error"));
  754. X          }
  755. X          else
  756. X             --chan->queued;
  757. X          if (ior->io_Length)
  758. X             FreeMem((char *)ior->io_Data, (long)ior->io_Length);
  759. X         FreeMem((char *)ior, (long)sizeof(IOR));
  760. X         continue;
  761. X       }
  762. X      switch(ior->io_Command) 
  763. X      {
  764. X         case DNCMD_CLOSE:
  765. X         case DNCMD_EOF:
  766. X            chan->eof = 1;
  767. X            ReplyMsg(&ior->io_Message);
  768. X            break;
  769. X         
  770. X         case DNCMD_WRITE:
  771. X            n = ior->io_Length - ior->io_Actual;
  772. X            if (n <= bytes)
  773. X            {
  774. X               memcpy(buf, ((char *)ior->io_Data) + ior->io_Actual, n);
  775. X               bytes -= n;
  776. X               len += n;
  777. X               buf += n;
  778. X               ReplyMsg(&ior->io_Message);
  779. X        } 
  780. X        else 
  781. X        {
  782. X               memcpy(buf, (char *)ior->io_Data + ior->io_Actual, bytes);
  783. X               len += bytes;
  784. X               ior->io_Actual += bytes;
  785. X               bytes = 0;
  786. X               Forbid();   /*  DNET device is a task, no need to Disable() */
  787. X               ior->io_Message.mn_Node.ln_Type = NT_MESSAGE;
  788. X               AddHead(&chan->port.mp_MsgList, (struct Node *)ior);
  789. X               Permit();
  790. X            }
  791. X        break;
  792. X         default:
  793. X            ior->io_Error = 1;
  794. X            ReplyMsg(&ior->io_Message);
  795. X      }
  796. X    }
  797. X    FixSignal(chan);
  798. X    if (chan->eof)
  799. X       SetSignal(1 << chan->port.mp_SigBit, 1 << chan->port.mp_SigBit);
  800. X    return(len);
  801. X}
  802. X
  803. Xint DRead(chan, buf, bytes)
  804. Xchar *buf;
  805. Xstruct DChannel * chan;
  806. Xint bytes;
  807. X{
  808. X   long len;
  809. X   long n;
  810. X
  811. X   len = 0;
  812. X   if (chan->eof) 
  813. X   {
  814. X      BUG(("****DNET EOF!!!\n"));
  815. X      return(-1);
  816. X   }
  817. X
  818. X   while (bytes)
  819. X   {
  820. X      WaitPort(&chan->port);
  821. X      n = DNRead(chan, buf, bytes);
  822. X      len += n;
  823. X      if (n < 0) break;
  824. X      buf += n;
  825. X      bytes -= n;
  826. X      if (chan->eof) break;
  827. X   }
  828. X   return(len);
  829. X}
  830. X
  831. Xvoid DQueue(chan, n)
  832. Xstruct DChannel * chan;
  833. Xint n;
  834. X{
  835. X    chan->qlen = n;
  836. X}
  837. X
  838. XDWrite(chan, buf, bytes)
  839. Xstruct DChannel * chan;
  840. Xchar *buf;
  841. Xint bytes;
  842. X{
  843. X    IOR tmpior;
  844. X    IOR *ior;
  845. X    int error;
  846. X
  847. X   error = bytes;
  848. X   if (chan->qlen) 
  849. X   {
  850. X      if (WaitQueue(chan, NULL) >= 0) 
  851. X      {
  852. X         ior = (IOR *)AllocMem(sizeof(IOR), MEMF_CLEAR|MEMF_PUBLIC);
  853. X         ior->io_Command = DNCMD_WRITE;
  854. X         ior->io_Unit = (void *)chan->chan;
  855. X         ior->io_Offset = (long)chan;
  856. X         ior->io_Message.mn_ReplyPort = &chan->port;
  857. X         ior->io_Data = (APTR)AllocMem(bytes, MEMF_PUBLIC);
  858. X         ior->io_Length = bytes;
  859. X         memcpy((char *)ior->io_Data, buf, (int)bytes);
  860. X         PutMsg(chan->dnetport, &ior->io_Message);
  861. X         ++chan->queued;
  862. X      } 
  863. X      else
  864. X      {
  865. X         error = -1;
  866. X      }
  867. X   } 
  868. X   else 
  869. X   {
  870. X      tmpior.io_Command = DNCMD_WRITE;
  871. X      tmpior.io_Unit = (void *)chan->chan;
  872. X      tmpior.io_Offset = (long)chan;
  873. X      tmpior.io_Message.mn_ReplyPort = &chan->port;
  874. X      tmpior.io_Data = (APTR)buf;
  875. X      tmpior.io_Length = bytes;
  876. X      PutMsg(chan->dnetport, &tmpior.io_Message);
  877. X      WaitMsg(&tmpior);
  878. X      if (tmpior.io_Error)
  879. X      {
  880. X         error = -1;
  881. X         BUG(("*****DWrite: io_Error %d\n", tmpior.io_Error));
  882. X         BUGGETC
  883. X      }
  884. X   }
  885. X   FixSignal(chan);
  886. X   return(error);
  887. X}
  888. X
  889. Xvoid DEof(chan)
  890. Xstruct DChannel * chan;
  891. X{
  892. X    IOR ior;
  893. X
  894. X    ior.io_Command = DNCMD_EOF;
  895. X    ior.io_Unit = (void *)chan->chan;
  896. X    ior.io_Offset = (long)chan;
  897. X    ior.io_Message.mn_ReplyPort = &chan->port;
  898. X    PutMsg(chan->dnetport, &ior.io_Message);
  899. X    WaitMsg(&ior);
  900. X    FixSignal(chan);
  901. X}
  902. X
  903. Xvoid DIoctl(chan, cmd, val, aux)
  904. Xstruct DChannel * chan;
  905. Xubyte cmd;
  906. Xuword val;
  907. Xubyte aux;
  908. X{
  909. X    IOR ior;
  910. X
  911. X    ior.io_Command = DNCMD_IOCTL;
  912. X    ior.io_Unit = (void *)chan->chan;
  913. X    ior.io_Offset = (long)chan;
  914. X    ior.io_Message.mn_ReplyPort = &chan->port;
  915. X    ior.io_Data = (APTR)(long)((val<<16)|(aux<<8)|cmd);
  916. X    PutMsg(chan->dnetport, &ior.io_Message);
  917. X    WaitMsg(&ior);
  918. X    FixSignal(chan);
  919. X}
  920. X
  921. Xint DQuit(host)
  922. Xchar *host;
  923. X{
  924. X    IOR ior;
  925. X    char buf[sizeof(DNETPORTNAME)+32];
  926. X    PORT *replyport;
  927. X    PORT *dnetport;
  928. X
  929. X    if (!host)
  930. X    host = "0";
  931. X    sprintf(buf, "%s%s", DNETPORTNAME, host);
  932. X    if (dnetport = FindPort(buf)) {
  933. X        replyport = CreatePort(NULL, 0);
  934. X    ior.io_Command = DNCMD_QUIT;
  935. X    ior.io_Unit = 0;
  936. X    ior.io_Offset = 0;
  937. X    ior.io_Message.mn_ReplyPort = replyport;
  938. X    PutMsg(dnetport, &ior.io_Message);
  939. X    WaitMsg(&ior);
  940. X    DeletePort(replyport);
  941. X    }
  942. X    return(dnetport != NULL);
  943. X}
  944. X
  945. X
  946. Xvoid DClose(chan)
  947. Xstruct DChannel * chan;
  948. X{
  949. X    IOR ior;
  950. X    IOR *io;
  951. X
  952. XBUG(("DClose: Enter\n"))
  953. X
  954. X    ior.io_Command = DNCMD_CLOSE;
  955. X    ior.io_Unit = (void *)chan->chan;
  956. X    ior.io_Offset = (long)chan;
  957. X    ior.io_Message.mn_ReplyPort = &chan->port;
  958. X    PutMsg(chan->dnetport, &ior.io_Message);
  959. X    ++chan->queued;
  960. X    chan->qlen = 0;
  961. X    WaitQueue(chan, &ior);
  962. X    while ((io = (IOR *)RemHead((struct List *)&chan->rdylist)) || 
  963. X           (io = (IOR *)GetMsg(&chan->port))) {
  964. X    io->io_Error = 1;
  965. X    ReplyMsg(&io->io_Message);
  966. X    }
  967. X    DeleteChannel(chan);
  968. X}
  969. X
  970. Xvoid WaitMsg(ior)
  971. XIOR *ior;
  972. X{
  973. X    while (ior->io_Message.mn_Node.ln_Type != NT_REPLYMSG)
  974. X    Wait(1 << ior->io_Message.mn_ReplyPort->mp_SigBit);
  975. X    Forbid();
  976. X    Remove((struct Node *)ior);
  977. X    Permit();
  978. X}
  979. X
  980. Xint WaitQueue(chan, skipior)
  981. Xstruct DChannel * chan;
  982. XIOR *skipior;
  983. X{
  984. X    register IOR *io;
  985. X    short error;
  986. X
  987. X   error = 0;
  988. X    while (chan->queued > chan->qlen) {     /*  until done  */
  989. X    WaitPort(&chan->port);   /*  something   */
  990. X    io = (IOR *)GetMsg(&chan->port);
  991. X    if (io->io_Message.mn_Node.ln_Type == NT_REPLYMSG) {
  992. X        if (error == 0)
  993. X        error = io->io_Error;
  994. X        if (io != skipior) {
  995. X        if (io->io_Length)
  996. X            FreeMem((char *)io->io_Data, io->io_Length);
  997. X        FreeMem((char *)io, sizeof(IOR));
  998. X        }
  999. X        --chan->queued;
  1000. X    } else {
  1001. X        AddTail(&chan->rdylist, (struct Node *)io);
  1002. X    }
  1003. X    }
  1004. X    return(error);
  1005. X}
  1006. X
  1007. Xstatic struct DChannel *MakeChannel(ior, host)
  1008. Xregister IOR *ior;
  1009. Xchar *host;
  1010. X{
  1011. X    struct DChannel * chan;
  1012. X    char buf[sizeof(DNETPORTNAME)+32];
  1013. X
  1014. XBUG(("MakeChannel: Entry\n"))
  1015. X
  1016. X    chan = (struct DChannel *)AllocMem(sizeof(struct DChannel), 
  1017. X                                       MEMF_PUBLIC|MEMF_CLEAR);
  1018. X
  1019. X    /*    Name, Pri */
  1020. X    chan->port.mp_Node.ln_Type = NT_MSGPORT;
  1021. X    chan->port.mp_SigBit = AllocSignal(-1);
  1022. X    chan->port.mp_SigTask = FindTask(NULL);
  1023. X    NewList(&chan->port.mp_MsgList);
  1024. X    NewList(&chan->rdylist);
  1025. X    chan->chan = (long)ior->io_Unit;
  1026. X    ior->io_Offset = (long)chan;
  1027. X    if (host) {
  1028. X       sprintf(buf, "%s%s", DNETPORTNAME, host);
  1029. X    ior->io_Message.mn_ReplyPort = FindPort(buf);
  1030. X    }
  1031. X    chan->dnetport = ior->io_Message.mn_ReplyPort;
  1032. X    return(chan);
  1033. X}
  1034. X
  1035. Xstatic void
  1036. XDeleteChannel(chan)
  1037. Xstruct DChannel * chan;
  1038. X{
  1039. X    FreeSignal(chan->port.mp_SigBit);
  1040. X    FreeMem((char *)chan, (long)sizeof(struct DChannel));
  1041. X}
  1042. X
  1043. Xstatic void
  1044. XFixSignal(chan)
  1045. Xregister struct DChannel * chan;
  1046. X{
  1047. X    if (chan->port.mp_MsgList.lh_Head != 
  1048. X             (NODE *)&chan->port.mp_MsgList.lh_Tail ||
  1049. X       chan->rdylist.lh_Head != (NODE *)&chan->rdylist.lh_Tail)
  1050. X    SetSignal(1 << chan->port.mp_SigBit, 1 << chan->port.mp_SigBit);
  1051. X}
  1052. X
  1053. SHAR_EOF
  1054. if `test ! -d doc`
  1055. then
  1056.   mkdir doc
  1057.   echo "mkdir doc"
  1058. fi
  1059. echo "extracting doc/README"
  1060. sed 's/^X//' << \SHAR_EOF > doc/README
  1061. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  1062. X* |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
  1063. X* |. o.| ||          All Rights Reserved                                  *
  1064. X* | .  | ||          Written by John Toebes and Doug Walker               *
  1065. X* | o  | ||          The Software Distillery                              *
  1066. X* |  . |//           235 Trillingham Lane                                 *
  1067. X* ======             Cary, NC 27513                                       *
  1068. X*                    BBS:(919)-471-6436                                   *
  1069. X\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1070. X
  1071. XThis material is Copyright (C) 1988 and 1989 The Software Distillery.
  1072. XIt may be distributed freely as long as the following restrictions are met:
  1073. X
  1074. X   1.  All files present in the distribution package must be redistributed
  1075. X       with the package, including this documentation file.  If you 
  1076. X       distribute on diskette, all files must be on a single diskette.
  1077. X       A list of files in this distribution is at the end of this file.
  1078. X
  1079. X   2.  The distributor may charge a fee to recover distribution costs.
  1080. X       The fee for diskette distribution should not be more than the cost 
  1081. X       to obtain the same diskette from Fred Fish or The Software Distillery,
  1082. X       whichever is greater.  Current charge from The Software Distillery
  1083. X       is $6 per disk in the United States and Canada, $7 outside, including 
  1084. X       all postage and handling charges.
  1085. X
  1086. X   3.  The distributor agrees to cease distributing the programs and data
  1087. X       involved if requested to do so by authors or any member of The 
  1088. X       Software Distillery.
  1089. X
  1090. X------------------------------DISCLAIMER
  1091. X
  1092. XNeither The Software Distillery nor any of its members will be liable for 
  1093. Xany damage arising from the failure of this program to perform as described,
  1094. Xor any destruction of other programs or data residing on a system 
  1095. Xattempting to run the program.  While we know of no damaging errors, the 
  1096. Xuser of this program uses it at his or her own risk.
  1097. X
  1098. X-----------------------------FUNCTIONALITY 
  1099. X
  1100. XThe network handler in this distribution relies on DNET for communication,
  1101. Xbut all dependencies on DNET are isolated.  The intent is for a future 
  1102. Xrelease to support ANY COMMUNICATIONS METHOD, including serial, parallel,
  1103. XAppleTalk, DecNET, NFS, you name it, all simultaneously via external 
  1104. Xcommunications servers.
  1105. X
  1106. X
  1107. X============================================================================
  1108. X
  1109. XRUNNING THE NETWORK HANDLER:
  1110. X
  1111. XThese instructions talk about a 'local' machine and a 'remote' machine.
  1112. XThe network is symmetric, so for DNET at least, you can do the 
  1113. Xinstallation on both sides.  Just install all files on both machines,
  1114. Xand perform all commands on both machines.
  1115. X
  1116. X1. Install DNET on both machines.  Add an entry to the dnet.servers 
  1117. X   file on the remote machine for the network server.  A sample 
  1118. X   dnet.servers file is included in this distribution in the file 
  1119. X   "dnet.servers".  Note the server number for the network is 9492.  You 
  1120. X   will need to change the pathname specified in the sample dnet.servers 
  1121. X   file to reflect the path you intend to use.
  1122. X
  1123. X2. Copy netdnet-server to the path specified in the dnet.servers file on
  1124. X   the remote machine.
  1125. X
  1126. X3. Put a mountlist entry for the network handler in the local machine's
  1127. X   DEVS:MOUNTLIST.  A sample mountlist entry is included in this 
  1128. X   distribution in the file "mountlist".  If you do not want the network 
  1129. X   handler in l:, replace the specified path with one of your own.
  1130. X
  1131. X4. Copy netdnet-handler to the path specified in the mountlist on the 
  1132. X   local machine.
  1133. X
  1134. X5. Issue the CLI command "ASSIGN ROOT: <path>" on the remote machine.  The
  1135. X   network handler mounts the ROOT: device on the remote node as a network
  1136. X   node on the local node;  the place you point ROOT: to is where your
  1137. X   files will go.
  1138. X
  1139. X6. Copy the file NODE.INFO from the distribution disk to ROOT:.  This file 
  1140. X   contains the .info information for the remote node that will be 
  1141. X   displayed on the workbench screen of the local node.  Feel free to 
  1142. X   replace it with any DRAWER type .info file.
  1143. X
  1144. X7. Issue the CLI command "MOUNT NET:" on the local node.  The first 
  1145. X   reference to NET: after the MOUNT command will load the handler.  DNET
  1146. X   will load the server on the remote node automatically.
  1147. X
  1148. X8. If you want a two-way network, repeat steps 1-7, but this time switch
  1149. X   your idea of which node is 'local' and which is 'remote'.
  1150. X
  1151. X============================================================================
  1152. X
  1153. XOnce the NET: device is running, you can use the provided NETMOUNT command
  1154. Xto allow access to other devices besides ROOT: on the remote machine.
  1155. XNETMOUNT is a temporary stopgap until a real ROOT: device is implemented
  1156. Xthat allows access to all devices on a machine via a single handler.
  1157. X
  1158. XFor now, the NETMOUNT command format is
  1159. X
  1160. XNETMOUNT <local device> <node name> <remote device>
  1161. X
  1162. Xwhere <local device>  is the name you MOUNTed (usually NET:)
  1163. X      <node name>     is the name you want to refer to the new entry as
  1164. X      <remote device> is the name of the device on the remote node to use
  1165. X      
  1166. XFor example, 
  1167. X
  1168. XNETMOUNT NET: DF0 DF0:
  1169. X
  1170. Xwould allow you to access the floppy on the remote node by using the path
  1171. XNET:DF0.  Thus, 
  1172. X
  1173. XDIR NET:DF0
  1174. X
  1175. Xwould produce the same results as doing a DIR DF0: on the remote machine.
  1176. X
  1177. X============================================================================
  1178. X
  1179. XThe provided NETSTAT command gives you a visual idea of how much work your
  1180. Xnetwork is doing.  Run it with the command
  1181. X
  1182. XRUN NETSTAT <devicename>
  1183. X
  1184. Xwhere <devicename> is the name of your network device (probably NET:).
  1185. XClick on the close gadget in the upper left corner to exit.
  1186. X
  1187. X============================================================================
  1188. X
  1189. XDifferences and enhancements:
  1190. X
  1191. XVERSION 05/09/89:
  1192. X  First version released
  1193. X
  1194. XVERSION 07/18/89:
  1195. X
  1196. X- Speed improved due to decreasing minimum packet size
  1197. X  Should help when loading executables over the network and when doing
  1198. X  directory operations.
  1199. X
  1200. X- Debugging code removed
  1201. X  This makes the code smaller and faster
  1202. X
  1203. X- Bug fixed in the ACTION_CREATE_DIR packet
  1204. X
  1205. X============================================================================
  1206. X
  1207. XCONTENTS:  This distribution should contain the following files:
  1208. X           
  1209. X     server (dir)
  1210. X       device.c                         dir.c
  1211. X       dispatch.c                       file.c
  1212. X       io.c                             lock.c
  1213. X       main.c                           makefile
  1214. X       netdnet-server                   netdnet.c
  1215. X       server.h                         struct.h
  1216. X       volume.c                         
  1217. X     handler (dir)
  1218. X       device.c                         devio.c
  1219. X       dir.c                            file.c
  1220. X       handler.h                        io.c
  1221. X       lock.c                           main.c
  1222. X       makefile                         mount.c
  1223. X       netdnet-handler                  netdnet.c
  1224. X       process.c                        volume.c
  1225. X     doc (dir)
  1226. X       dnet.servers                     mountlist
  1227. X       netsource.doc                    README
  1228. X     util (dir)
  1229. X       handd                            handd.c
  1230. X       netmount                         netmount.c
  1231. X       netstat                          netstat.c
  1232. X       netstat.h                        netstat.lnk
  1233. X       shutdown                         shutdown.c
  1234. X  channel.h                        debug.c
  1235. X  dnet.h                           dnetlib.c
  1236. X  iodnet.c                         netcomm.h
  1237. X  netdev.h                         netdnet.h
  1238. X  proto.h                          request.c
  1239. X  sendpkt.c                        subs.c
  1240. X  timer.c                          
  1241. SHAR_EOF
  1242. echo "extracting doc/dnet.servers"
  1243. sed 's/^X//' << \SHAR_EOF > doc/dnet.servers
  1244. X
  1245. X8192  sys:dnet/scopy   ram:    ;File Transfer server
  1246. X8195    sys:dnet/sterm   ram:    ;Terminal Window server
  1247. X8196    sys:dnet/scli    ram:    ;Shell Server (needs pipe:)
  1248. X8197    sys:dnet/sloadav ram:    ;Load Average Server
  1249. X9492  sys:dnet/netdnet-server   ram:    ;File-handler Server
  1250. X
  1251. SHAR_EOF
  1252. echo "extracting doc/mountlist"
  1253. sed 's/^X//' << \SHAR_EOF > doc/mountlist
  1254. X
  1255. XNET:       Stacksize = 8000
  1256. X           Priority = 5
  1257. X           GlobVec = -1
  1258. X           Unit    =  0
  1259. X           Handler = l:netdnet-handler
  1260. X#
  1261. SHAR_EOF
  1262. echo "extracting doc/netsource.doc"
  1263. sed 's/^X//' << \SHAR_EOF > doc/netsource.doc
  1264. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  1265. X* |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
  1266. X* |. o.| ||          All Rights Reserved                                  *
  1267. X* | .  | ||          Written by John Toebes and Doug Walker               *
  1268. X* | o  | ||          The Software Distillery                              *
  1269. X* |  . |//           235 Trillingham Lane                                 *
  1270. X* ======             Cary, NC 27513                                       *
  1271. X*                    BBS:(919)-471-6436                                   *
  1272. X\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1273. X
  1274. XSOFTWARE DISTILLERY NETWORK FILE SYSTEM, VERSION 1.0
  1275. X
  1276. XThis material is Copyright (C) 1988 and 1989 The Software Distillery.
  1277. X
  1278. X------------------------------DISCLAIMER
  1279. X
  1280. XNeither The Software Distillery nor any of its members will be liable for 
  1281. Xany damage arising from the failure of this program to perform as described,
  1282. Xor any destruction of other programs or data residing on a system 
  1283. Xattempting to run the program.  While we know of no damaging errors, the 
  1284. Xuser of this program uses it at his or her own risk.
  1285. X
  1286. X-----------------------------FUNCTIONALITY 
  1287. X
  1288. XThe network handler in this distribution relies on DNET for communication,
  1289. Xbut all dependancies on DNET are isolated.  The intent is for a future 
  1290. Xrelease to support ANY COMMUNICATIONS METHOD, including serial, parallel,
  1291. XAppleTalk, DecNET, NFS, you name it, all simultaneously via external 
  1292. Xcommunications servers.  
  1293. X
  1294. X============================================================================
  1295. X
  1296. XSETTING UP THE SOURCE DIRECTORY
  1297. X
  1298. XIf you received this software as a ZOO archive, you should use the
  1299. Xx// option to de-archive it into its original directory structure.
  1300. XIf you didn't, delete the files produced and start over with
  1301. X
  1302. X   ZOO x// netsrc1.zoo
  1303. X
  1304. XYou should de-zoo the archive into its own directory, since there are
  1305. Xmany files in the root of the directory structure.
  1306. X
  1307. X============================================================================
  1308. X
  1309. XRUNNING THE NETWORK HANDLER:
  1310. X
  1311. XThese instructions talk about a 'local' machine and a 'remote' machine.
  1312. XThe network is symmetrical, so for DNET at least, you can do the 
  1313. Xinstallation on both sides.  Just install all files on both machines,
  1314. Xand perform all commands on both machines.
  1315. X
  1316. X1. Install DNET on both machines.  Add an entry to the dnet.servers 
  1317. X   file on the remote machine for the network server.  A sample 
  1318. X   dnet.servers file is included in this distribution in the file 
  1319. X   "dnet.servers".  Note the server number for the network is 9492.  You 
  1320. X   will need to change the pathname specified in the sample dnet.servers 
  1321. X   file to reflect the path you intend to use.
  1322. X
  1323. X2. Copy netdnet-server to the path specified in the dnet.servers file on
  1324. X   the remote machine.
  1325. X
  1326. X3. Put a mountlist entry for the network handler in the local machine's
  1327. X   DEVS:MOUNTLIST.  A sample mountlist entry is included in this 
  1328. X   distribution in the file "mountlist".  If you do not want the network 
  1329. X   handler in l:, replace the specified path with one of your own.
  1330. X
  1331. X4. Copy netdnet-handler from the HANDLER subdirectory to the path specified
  1332. X   in the mountlist on the local machine.
  1333. X
  1334. X5. Issue the CLI command "ASSIGN ROOT: <path>" on the remote machine.  The
  1335. X   network handler mounts the ROOT: device on the remote node as a network
  1336. X   node on the local node;  the place you point ROOT: to is where your
  1337. X   files will go.  Copy the file NODE.INFO from the distribution disk
  1338. X   to ROOT:.  This file contains the .info information for the remote node
  1339. X   that will be displayed on the workbench screen of the local node.  Feel
  1340. X   free to replace it with any DRAWER type .info file.
  1341. X
  1342. X6. Issue the CLI command "MOUNT NET:" on the local node.  The first 
  1343. X   reference to NET: after the MOUNT command will load the handler.  DNET
  1344. X   will load the server on the remote node automatically.
  1345. X
  1346. X============================================================================
  1347. X
  1348. XOnce the NET: device is running, you can use the provided NETMOUNT command
  1349. Xto allow access to other devices besides ROOT: on the remote machine.
  1350. XNETMOUNT is a temporary stopgap until a real ROOT: device is implemented
  1351. Xthat allows access to all devices on a machine via a single handler.
  1352. X
  1353. XFor now, the NETMOUNT command format is
  1354. X
  1355. XNETMOUNT <local device> <node name> <remote device>
  1356. X
  1357. Xwhere <local device>  is the name you MOUNTed (usually NET:)
  1358. X      <node name>     is the name you want to refer to the new entry as
  1359. X      <remote device> is the name of the device on the remote node to use
  1360. X      
  1361. XFor example, 
  1362. X
  1363. XNETMOUNT NET: DF0 DF0:
  1364. X
  1365. Xwould allow you to access the floppy on the remote node by using the path
  1366. XNET:DF0.  Thus, 
  1367. X
  1368. XDIR NET:DF0
  1369. X
  1370. Xwould produce the same results as doing a DIR DF0: on the remote machine.
  1371. X
  1372. X
  1373. X============================================================================
  1374. X
  1375. XThis version of NET: is dependent on DNET.  However, all DNET-specific calls
  1376. Xare isolated in the files iodnet.c, handler/netdnet.c and server/netdnet.c.
  1377. XFunctions in these files refer to functions in dnetlib.c;  dnetlib.c is
  1378. Xpart of Matt Dillon's DNET distribution and will not be required if you
  1379. Xreplace the functions in the three previously named files.
  1380. X
  1381. XThe source directory contains all .c and .h files common to both the handler
  1382. Xand the server ends of the network file system.  Handler-specific code 
  1383. Xresides in the 'handler' subdirectory;  server-specific code resides in the
  1384. X'server' subdirectory; and utilities such as the 'handd' debugging tool,
  1385. Xthe 'netstat' tool to give statistics, the 'shutdown' command to kill the
  1386. Xnetwork, and so forth reside in the 'utilities' subdirectory.
  1387. X
  1388. X
  1389. XContact us with any problems:
  1390. X
  1391. XPLINK:  DWALKER, JTOEBES
  1392. XBIX:    DJWALKER, JTOEBES
  1393. XUSENET: ...mcnc!rti!sas!walker, ...mcnc!rti!sas!toebes
  1394. X        (Usenet connection is flakey)
  1395. XUS MAIL:
  1396. X   Doug Walker
  1397. X   405 B3 Gooseneck Dr
  1398. X   Cary, NC 27513
  1399. X   USA
  1400. X
  1401. X   John Toebes
  1402. X   235 Trillingham Lane
  1403. X   Cary, NC 27513
  1404. X   USA
  1405. SHAR_EOF
  1406. echo "End of archive 1 (of 4)"
  1407. # if you want to concatenate archives, remove anything after this line
  1408. exit
  1409.